<template>
  <!-- 已放款和已归档 -->
  <div class="box clearfix">
    <section class="section_one">
      <FunctionalAreas
        :released="released"
        :orderNumber="orderNumber"
      ></FunctionalAreas>
      <div class="title_sub prduct_bod_r">产品说明：</div>
      <ProductDescriptionToo></ProductDescriptionToo>
    </section>
    <section class="section_wrap">
      <div class="title_sub infro_bod_l">信息查看：</div>
      <div class="state-box">
        <div>
          <div class="state" v-if="stateInfo.orderStatus==4">状态：已放款</div>
          <div class="state" v-if="stateInfo.orderStatus==12">状态：已结清</div>
        </div>
        <div class="clearedTime" v-if="stateInfo.orderStatus==12">结清时间:{{stateInfo.clearedTime}}</div>
      </div>
      <InformationsViewer
        v-if="template === 'template_01'"
        :orderNumber="orderNumber"
        :showButton="showButton"
      ></InformationsViewer>
      <InformationsViewer02
        v-if="template === 'template_02'"
        :orderNumber="orderNumber"
        :showButton="showButton"
      ></InformationsViewer02>
    </section>
    <section class="section_wrap">
      <!-- 归档处理 -->
      <div class="title_sub infdh_bod_l">贷后信息：</div>
      <PostLoan />
    </section>
    <section class="section_wrap" v-if="showFinancialInfo">
      <div class="title_sub infro_bod_l">财务信息:</div>
      <financialInfo :showBtn="showBtn" :orderNumber="orderNumber"></financialInfo>
    </section>
    <section class="section_wrap">
      <div class="title_sub infro_bod_l">风控大数据查询</div>
      <viewInfo> </viewInfo>
    </section>
    <section class="section_wrap" v-show="showFillAnIn">
      <div class="title_sub infro_bod_l">补登信息：</div>
      <FillAnInFormation
        :orderNumber="orderNumber"
        @showbox="toshow"
      ></FillAnInFormation>
    </section>
    <section class="section_wrap">
      <div class="title_sub infro_bod_l">审批信息：</div>
      <LoanInfor :orderNumber="orderNumber"></LoanInfor>
    </section>
    <section class="section_wrap">
      <div class="title_sub ingz_bod_l">提成规则：</div>
      <Commission :orderNumber="orderNumber"></Commission>
    </section>
    <section class="section_wrap">
      <div class="title_sub upload_bod_l">附件管理：</div>
      <!-- 上传组件 -->
      <Upload class="uploadStyle" :isNew="isNew"></Upload>
    </section>
    <section class="section_wrap">
      <Attachment></Attachment>
      <div class="title_sub prduct_bod_r">审批流：</div>
      <ApprovalText :orderNumber="orderNumber"></ApprovalText>
    </section>
  </div>
</template>

<script>
import { getOrderOne, getProductUrl } from "../../../src/assets/js/api";
import FunctionalAreas from "../../components/meitList/FunctionalAreas";
import ProductDescriptionToo from "../../components/meitList/ProductDescriptionToo";
import InformationsViewer from "../../components/meitList/InformationsViewer";
import InformationsViewer02 from "../../components/meitList/InformationsViewer02";
import ApprovalText from "../../components/meitList/ApprovalText";
import Attachment from "../../components/meitList/Attachment";
import Upload from "../../components/meitList/Upload";
import Commission from "../../components/meitList/Commission";
import PostLoan from "../../components/PostLoan/PostLoanLYF.vue";
// import LoanInfor from "@/components/meitList/LoanInfor";
import LoanInfor from "@/components/businessList/LoanInfor";
import FillAnInFormation from "../../components/meitList/FillAnInFormation";
import viewInfo from "../../components/business/viweInfo.vue";
import financialInfo from "../../components/business/financialInfo";
import { checkPermiss } from "../../assets/js/utlis";

export default {
  name: "Released",
  components: {
    FunctionalAreas,
    ProductDescriptionToo,
    InformationsViewer,
    InformationsViewer02,
    ApprovalText,
    Attachment,
    Upload,
    Commission,
    PostLoan,
    LoanInfor,
    FillAnInFormation,
    viewInfo,
    financialInfo,
  },
  data() {
    return {
      released: true,
      orderNumber: "",
      markUpdate: "",
      isNew: false,
      showButton: false,
      showFillAnIn: true,
      prductId: "",
      template: "",
      golbalPermissions: [],
      stateInfo: {}
    };
  },
  created() {
    this.orderNumber = sessionStorage.getItem("orderNumber");
    this.prductId = parseInt(sessionStorage.getItem("prductId"));
    this.getOrderOne(this.prductId);
    this.golbalPermissions = localStorage.getItem("permissions").split(",");
    this.getState();
  },
  computed: {
    //财务信息按钮显示
    showBtn: function() {
      return checkPermiss("business:updateFinancial:ryd", this.golbalPermissions);

    },
    //财务信息
    showFinancialInfo: function() {
      return checkPermiss("business:upForm:financial:ryd", this.golbalPermissions);
    }
  },
  methods: {
    getState() {
      getProductUrl({
        orderNumber: this.orderNumber
      }).then(res => {
        this.stateInfo = res.data;
      });
    },
    //查询产品模板
    getOrderOne(id) {
      getOrderOne(id).then((res) => {
        this.template = res.data.pcCode;
      });
    },
    toshow(msg) {
      this.showFillAnIn = msg;
    },
  },
};
</script>

<style scoped type="less">
.text {
  font-size: 20px;
  font-weight: bold;
  margin-top: 20px;
  text-align: left;
  text-indent: 2em;
}
.state {
  font-size: 22px;
  font-weight: bold;
  float: right;
  margin-top: -20px;
  /*margin-right: 3%;*/
}

.uploadStyle {
  position: relative;
  margin-top: 20px;
}
.commission {
  line-height: 70px;
  height: 70px;
}
.commissionText {
  font-size: 20px;
  font-weight: bold;
  float: left;
  margin-left: 3%;
}

</style>
